<!--
 * @Author: zxc
 * @Date: 2020-09-13 18:06:37
 * @LastEditTime: 2020-09-13 19:01:12
 * @LastEditors: zxc
 * @Description:
-->
<template>
  <div>
    <count-to ref="countTo" :end-val='endVal' @on-animation-end='handleEnd'></count-to>
    <button @click="getNumber">获取数值</button>
    <button @click="up">更新值</button>
  </div>
</template>

<script>
import CountTo from "@/components/count-to"
export default {
  components: {
    CountTo
  },
  data() {
    return {
      endVal:100
    }
  },
  methods: {
    getNumber () {
      console.log(this.$refs.countTo.getCount())
    },
    up () {
      this.endVal += Math.random() * 100
    },
    handleEnd (value) {
      console.log('end -> ', value)
    }
  }
};
</script>

<style>
</style>
